﻿<%@ Page Title="货架基本资料" Language="C#" MasterPageFile="~/master/m.master" %>

<script runat="server">
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<link href="../assets/css/plugins/footable/footable.core.css" rel="stylesheet">
<link href="../assets/css/shelf/base.css" rel="stylesheet">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="main" runat="Server">
    <div class="system-box">
        <div class="right-side">
            <div class="btns-container"></div>
            <div class="condition">
            	<label>关键字</label>
            	<input class="form-control input-w160" id="search-keys" placeholder="货架编号/名称" />
            	<label>时间范围</label>
            	<input type="text" class="form-control layer-date" placeholder="开始时间" id="search-start" />
				<label class="to">到</label>
				<input type="text" class="form-control layer-date"  placeholder="结束时间" id="search-end" />
            </div>
            
            <div class="right-content-box">
            	<div class="ibox-content">
	                <table class="footable table table-stripped">
	                    <thead></thead>
	                    <tbody id="pageList"></tbody>
	                </table>
	            </div>
            </div>
            
            <div class="pageControl"></div>
        </div>
    </div>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="footer" runat="Server">
    <script src="../assets/js/plugins/layer/laydate/laydate.js"></script>
	<script src="../assets/js/page/pageControl.js"></script>
	<script src="../assets/js/page/rScroll.js"></script>
	<script src="../assets/js/page/tableControl.js"></script>

    <script type="application/javascript">
        $(document).ready(function () {
            //初始化日期控件
            var searchstart = {
                elem: "#search-start",
                format: "YYYY-MM-DD",
                min: "2015-12-01",
                max: "2099-12-01",
                istime: true,
                istoday: false,
                choose: function (datas) {
                    searchend.min = datas;
                    searchend.start = datas
                }
            };
            var searchend = {
                elem: "#search-end",
                format: "YYYY-MM-DD",
                min: "2015-12-01",
                max: "2099-12-01",
                istime: true,
                istoday: false,
                choose: function (datas) {
                    searchstart.max = datas
                }
            };
            laydate(searchstart);
            laydate(searchend);
            //模块ID
            var ModuleID = Y.getUrlParam("ModuleID");
            //用于记录页数
            var page = 1;
			//用于记录每页多少条记录
			var size = 10;

//			var GSID = 0;

			//获取按钮
			commonUtil.loadBtnList(ModuleID,function(){
			    rScroll();
			});

            //加载信息列表
            var loadList = function(page){
            	if($('.footable thead').children().size() == 0)
            		tableControl.initThead2('.footable',['店铺编号','标题','类型','变更人','变更时间','变更内容']);
            	            	
            	pageControl.init('ShopShelf','GetLog',{
					Keys: $('#search-keys').val(),
            		BeginDate: $('#search-start').val(),
            		StopDate: $('#search-end').val(),
            		Page: page,
//          		Size: size,
				},function(result){
					page = result.page;
					var tBody = [];
					if (!Y.checkNull(result.data)) {
						if (result.data.Items.length > 0){	
							result.data.Items.map(function(item,i){					
								var tempTr = {
									trClass: (i % 2 == 0 ? 'gradeX footable-even' : 'gradeX footable-odd' ),
									children: [
										{tdText: item.ID, c:0 , r:0, tdHtml:'', tdId:'', tdClass:'hide'},
										{tdText: (item.ShopCode || ' '), c:0 , r:0, tdHtml:'', tdId:'', tdClass:''},
										{tdText: (item.Context || ' '), c:0 , r:0, tdHtml:'', tdId:'', tdClass:''},
										{tdText: (item.Type == 1 ? '货架数量变更': '货架陈列信息'), c:0 , r:0, tdHtml:'', tdId:'', tdClass:''},
										{tdText: (item.Operator || ' '), c:0 , r:0, tdHtml:'', tdId:'', tdClass:''},
										{tdText: item.OperatorDate.substring(0,10), c:0 , r:0, tdHtml:'', tdId:'', tdClass:''},
										{tdText: (item.Memo || ' '), c:0 , r:0, tdHtml:'', tdId:'', tdClass:''},
									]
								};
								tBody.push(tempTr);
							})
						}
						rScroll();
					}
					tableControl.initTbody('.footable',(tBody.length > 0 ? tBody : null),6,null);
				});
            }

			//点击查询
			$('.btns-container').on('click', '#btn-search', function () {
			    loadList(1);
			});
  
			loadList(1);
        })
    </script>
</asp:Content>

